home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GMS / GMSDev / Includes / graphics / blitter.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-30  |  16.4 KB  |  403 lines

  1. #ifndef GRAPHICS_BLITTER_H
  2. #define GRAPHICS_BLITTER_H TRUE
  3.  
  4. /*
  5. **  $VER: blitter.h V0.9B
  6. **
  7. **  Blitter Definitions
  8. **
  9. **  (C) Copyright 1996-1997 DreamWorld Productions.
  10. **      All Rights Reserved
  11. */
  12.  
  13. #ifndef DPKERNEL_H
  14. #include <dpkernel/dpkernel.h>
  15. #endif
  16.  
  17. /***************************************************************************
  18. ** Bitmap Object.
  19. */
  20.  
  21. #define BMPVERSION  1
  22. #define TAGS_BITMAP ((ID_SPCTAGS<<16)|ID_BITMAP)
  23.  
  24. struct Bitmap {
  25.   struct Head Head;    /* [00] Standard structure header */
  26.   APTR   Data;         /* [12] Pointer to bitmap data area */
  27.   WORD   Width;        /* [16] Width */
  28.   WORD   ByteWidth;    /* [18] ByteWidth */
  29.   WORD   Height;       /* [20] Height */
  30.   WORD   Type;         /* [22] Screen type */
  31.   LONG   LineMod;      /* [24] Line differential */
  32.   LONG   PlaneMod;     /* [28] Plane differential */
  33.   struct Head *Parent; /* [32] Bitmap owner */
  34.   APTR   Restore;      /* [36] Restore list for this bitmap, if any */
  35.   LONG   Size;         /* [40] Total size of the bitmap in bytes */
  36.   LONG   MemType;      /* [44] Memory type to use in allocation */
  37.   WORD   Planes;       /* [48] Amount of planes */
  38.   WORD   resEmpty;     /* [50] Reserved */
  39.   LONG   AmtColours;   /* [52] Maximum amount of colours available */
  40.  
  41.   /*** Private fields below ***/
  42.  
  43.   WORD   prvAFlags;    /* Allocation flags */
  44. };
  45.  
  46. #define BMA_Data       (TAPTR|12)
  47. #define BMA_Width      (TWORD|16)
  48. #define BMA_ByteWidth  (TWORD|18)
  49. #define BMA_Height     (TWORD|20)
  50. #define BMA_Type       (TWORD|22)
  51. #define BMA_LineMod    (TLONG|24)
  52. #define BMA_PlaneMod   (TLONG|28)
  53. #define BMA_Parent     (TAPTR|32)
  54. #define BMA_Restore    (TAPTR|36)
  55. #define BMA_Size       (TLONG|40)
  56. #define BMA_MemType    (TLONG|44)
  57. #define BMA_Planes     (TWORD|48)
  58. #define BMA_AmtColours (TLONG|52)
  59.  
  60. /***************************************************************************
  61. ** Restore Object.
  62. */
  63.  
  64. #define RSTVERSION   1
  65. #define TAGS_RESTORE ((ID_SPCTAGS<<16)|ID_RESTORE)
  66.  
  67. struct Restore {
  68.   struct Head Head;      /* Standard header */
  69.   WORD   Buffers;        /* Amount of screen buffers */
  70.   WORD   Entries;        /* Amount of entries */
  71.   struct Head *Owner;    /* Owner of the restorelist, ie bitmap */
  72.  
  73.   /*** Private fields below ***/
  74.  
  75.   struct RstEntry *List1;
  76.   struct RstEntry *List2;
  77.   struct RstEntry *List3;
  78.   struct RstEntry *ListPos1;
  79.   struct RstEntry *ListPos2;
  80.   struct RstEntry *ListPos3;
  81. };
  82.  
  83. /* This structure is completely private */
  84.  
  85. struct RstEntry {
  86.   struct RstEntry *Next;  /* Next restore entry in the chain */
  87.   struct RstEntry *Prev;  /* Previous restore enty in the chain */
  88.   APTR   Bob;             /* Bob structure belonging to the restore [*] */
  89.   APTR   Address;         /* Screen pointer (top of screen) [*] */
  90.   APTR   Storage;         /* Background storage or NULL */
  91.   APTR   Control;         /* Controls from the lookup table */
  92.   APTR   ConMask;         /* The control mask to use */
  93.   WORD   Modulo1;         /* Modulo C */
  94.   LONG   Modulo2;         /* Modulos A/D */
  95.   WORD   BlitWidth;       /* [*] */
  96.   WORD   BlitHeight;      /* [*] */
  97. };
  98.  
  99. #define RSA_Buffers (12|TWORD)
  100. #define RSA_Entries (14|TWORD)
  101. #define RSA_Owner   (16|TAPTR)
  102.  
  103. /***************************************************************************
  104. ** Bob Object.
  105. */
  106.  
  107. #define BOBVERSION  1
  108. #define TAGS_BOB    ((ID_SPCTAGS<<16)|ID_BOB)
  109.  
  110. struct  FrameList {
  111.   WORD  XCoord;
  112.   WORD  YCoord;
  113. };
  114.  
  115. struct   Bob {
  116.   struct Head Head;             /* [00] Standard structure header */
  117.   BYTE   *GfxData;              /* [12] Pointer to graphics source */
  118.   BYTE   *MaskData;             /* [16] Pointer to mask source */
  119.   struct FrameList *GfxCoords;  /* [20] Pointer to graphic frame coordinates */
  120.   WORD   Frame;                 /* [24] Current frame */
  121.   WORD   SrcWidth;              /* [26] Source Page Width in bytes */
  122.   WORD   Width;                 /* [28] Width in pixels */
  123.   WORD   ByteWidth;             /* [30] Width in bytes */
  124.   WORD   XCoord;                /* [32] To X pixel */
  125.   WORD   YCoord;                /* [34] To Y pixel */
  126.   WORD   Height;                /* [36] Height in pixels */
  127.   WORD   ClipLX;                /* [38] Left X border */
  128.   WORD   ClipTY;                /* [40] Top Y border */
  129.   WORD   ClipRX;                /* [42] Right X border */
  130.   WORD   ClipBY;                /* [44] Bottom Y border */
  131.   WORD   FPlane;                /* [46] 1st Plane to blit to (planar only) */
  132.   WORD   Planes;                /* [48] Amount of planes */
  133.   WORD   PropHeight;            /* [50] Expected height of source picture */
  134.   WORD   PropWidth;             /* [52] Expected width of source picture */
  135.   WORD   Buffers;               /* [54] Relevant only to restore mode */
  136.   LONG   PlaneSize;             /* [56] Size of source plane (planar only) */
  137.   LONG   Attrib;                /* [60] Attributes like CLIP and MASK */
  138.   struct Bitmap *SrcBitmap;     /* [64] Source Bitmap */
  139.   WORD   Empty;                 /* [68] Reserved, in use by MBob */
  140.   WORD   SrcMaskWidth;          /* [70] Mask page width in bytes */
  141.   APTR   Source;                /* [72] Pointer to source object */
  142.   APTR   *DirectGfx;            /* [76] Pointer to direct frame list */
  143.   struct GScreen *Screen;       /* [80] Destination Screen */
  144.   struct Bitmap  *DestBitmap;   /* [84] Destination Bitmap */
  145.   struct FrameList *MaskCoords; /* [88] Pointer to mask frame coordinates */
  146.   APTR   *DirectMasks;          /* [92] */
  147.   WORD   AmtFrames;             /* [96] Amount of frames in frame/direct list */
  148.  
  149.   /*** Private fields start now ***/
  150.  
  151.   WORD   prvStoreSize;      /* 4/8/12 Sizeof one store entry (MBob's) */
  152.   APTR   prvStoreBuffer;    /* A/B/C [0/4/8] storage pointer (MBob's) */
  153.   WORD   prvStoreMax;       /* Maximum store position */
  154.   APTR   prvStoreMemory;    /* Master storage pointer (for the freemem) */
  155.   WORD   prvStoreCount;     /* Counter for store, 0, 4, 8 */
  156.   BYTE   *prvStoreA;        /* Storage buffer 1 */
  157.   BYTE   *prvStoreB;        /* Storage buffer 2 */
  158.   BYTE   *prvStoreC;        /* Storage buffer 3 */
  159.   APTR   prvDrawRoutine;    /* Routine for drawing/clearing/storing */
  160.   APTR   prvClearRoutine;   /* Routine for clearing */
  161.   APTR   prvRestoreRoutine; /* Routine for restoring/clearing */
  162.   APTR   prvHeightRoutine;  /* Replaces BS_DrawRoutine for large heights */
  163.   LONG   prvScreenSize;     /* Size of destination plane */
  164.   WORD   prvModulo;         /* Bob Modulo (PicWidth-BobWidth) */
  165.   WORD   prvMaskModulo;     /* Mask Modulo (BobWidth-BobWidth for GENMASK) */
  166.   APTR   prvMaskMemory;     /* Master mask pointer (for the freemem) */
  167.   WORD   prvMaxHeight;      /* Maximum possible height, limited by blitter */
  168.   WORD   prvScrLine;        /* Size of a line (for interleaved) */
  169.   WORD   prvBobLine;        /* Size of a Bob line (Width*Planes) */
  170.   WORD   prvMaskLine;       /* Size of a Mask Line (Width*Planes) */
  171.   WORD   prvTrueWidth;      /* The true pixel width (++shift) */
  172.   WORD   prvTrueBWidth;     /* The true byte width (++shift) */
  173.   WORD   prvTrueWWidth;     /* The true word width (++shift) */
  174.   WORD   prvClipBLX;        /* ClipLX, byte */
  175.   WORD   prvClipBRX;        /* ClipRX, byte */
  176.   WORD   prvModuloC;        /* Modulus (C) */ 
  177.   WORD   prvModuloB;        /* Modulus (B) */ 
  178.   WORD   prvModuloA;        /* Modulus (A) */
  179.   WORD   prvModuloD;        /* Modulus (D) */
  180.   WORD   prvNSModuloC;      /* NSModulus (C) */ 
  181.   WORD   prvNSModuloB;      /* NSModulus (B) */ 
  182.   WORD   prvNSModuloA;      /* NSModulus (A) */ 
  183.   WORD   prvNSModuloD;      /* NSModulus (D) */ 
  184.   WORD   prvWordWidth;      /* The word width */
  185.   BYTE   prvAFlags;         /* Allocation flags */
  186.   BYTE   prvPad;
  187. };
  188.  
  189. #define BBA_GfxData      (12|TAPTR)
  190. #define BBA_MaskData     (16|TAPTR)
  191. #define BBA_GfxCoords    (20|TAPTR)
  192. #define BBA_Frame        (24|TWORD)
  193. #define BBA_SrcWidth     (26|TWORD)
  194. #define BBA_Width        (28|TWORD)
  195. #define BBA_ByteWidth    (30|TWORD)
  196. #define BBA_XCoord       (32|TWORD)
  197. #define BBA_YCoord       (34|TWORD)
  198. #define BBA_Height       (36|TWORD)
  199. #define BBA_ClipLX       (38|TWORD)
  200. #define BBA_ClipTY       (40|TWORD)
  201. #define BBA_ClipRX       (42|TWORD)
  202. #define BBA_ClipBY       (44|TWORD)
  203. #define BBA_FPlane       (46|TWORD)
  204. #define BBA_Planes       (48|TWORD)
  205. #define BBA_PropHeight   (50|TWORD)
  206. #define BBA_PropWidth    (52|TWORD)
  207. #define BBA_Buffers      (54|TWORD)
  208. #define BBA_PlaneSize    (56|TLONG)
  209. #define BBA_Attrib       (60|TLONG)
  210. #define BBA_Empty        (64|TWORD)
  211. #define BBA_SrcMaskWidth (70|TWORD)
  212. #define BBA_Source       (72|TAPTR)
  213. #define BBA_DirectGfx    (76|TAPTR)
  214. #define BBA_Screen       (80|TAPTR)
  215. #define BBA_DestBitmap   (84|TAPTR)
  216. #define BBA_MaskCoords   (88|TAPTR)
  217. #define BBA_DirectMasks  (92|TAPTR)
  218. #define BBA_AmtFrames    (96|TWORD)
  219.  
  220. #define BBA_SourceTags   (TSTEPIN|TTRIGGER|72)
  221.  
  222. /***********************************************************************************/
  223.  
  224. #define MBOBVERSION 1
  225. #define TAGS_MBOB   ((ID_SPCTAGS<<16)|ID_MBOB)
  226.  
  227. struct MBob {
  228.   struct Head Head;              /* [00] Standard structure header */
  229.   APTR   GfxData;                /* [12] Pointer to graphics source */
  230.   APTR   MaskData;               /* [] Pointer to mask source */
  231.   struct FrameList *FrameList;   /* [] Pointer to frame list */
  232.   WORD   AmtEntries;             /* [] Amount of entries in the list */
  233.   WORD   SrcWidth;               /* [] Source Page Width in bytes */
  234.   WORD   Width;                  /* [] Width in pixels (optional) */
  235.   WORD   ByteWidth;              /* [] Width in bytes */
  236.   APTR   EntryList;              /* [] :MB: Pointer to entry list */
  237.   WORD   Height;                 /* [] Height in pixels */
  238.   WORD   ClipLX;                 /* [] Left X border */
  239.   WORD   ClipTY;                 /* [] Top Y border */
  240.   WORD   ClipRX;                 /* [] Right X border */
  241.   WORD   ClipBY;                 /* [] Bottom Y border */
  242.   WORD   FPlane;                 /* [] 1st Plane to blit to (planar only) */
  243.   WORD   Planes;                 /* [] Amount of planes */
  244.   WORD   PropHeight;             /* [] Expected height of source picture */
  245.   WORD   PropWidth;              /* [] Expected width of source picture */
  246.   WORD   Buffers;                /* [] Relevent only to restore mode */
  247.   LONG   PlaneSize;              /* [] Size of source plane (planar only) */
  248.   LONG   Attrib;                 /* [] Attributes like CLIP and MASK */
  249.   struct Bitmap *SrcBitmap;      /* [] Source Bitmap */
  250.   WORD   EntrySize;              /* [] Entry size (sizeof(struct MBEntry)) */
  251.   WORD   SrcMaskWidth;           /* [] Mask page width in bytes */
  252.   APTR   Source;                 /* [] Pointer to source object */
  253.   LONG   *DirectGfx;             /* [] Pointer to direct frame list */
  254.   struct GScreen   *Screen;      /* [] The MBob's destination Screen */
  255.   struct Bitmap    *DestBitmap;  /* [] The MBob's destination Bitmap */
  256.   struct FrameList *MaskCoords;  /* [] */
  257.   LONG   *DirectMasks;           /* [] */
  258.   WORD   AmtFrames;              /* [] Amount of frames in frame/direct list */
  259.  
  260.   /*** Private fields start now ***/
  261.  
  262.   WORD   prvStoreSize;        /* 4/8/12 Sizeof one store entry (MBob's) */
  263.   APTR   prvStoreBuffer;      /* A/B/C [0/4/8] storage pointer (MBob's) */
  264.   WORD   prvStoreMax;         /* Maximum store position */
  265.   APTR   prvStoreMemory;      /* Master storage pointer (for the freemem) */
  266.   WORD   prvStoreCount;       /* Counter for store, 0, 4, 8 */
  267.   APTR   prvStoreA;           /* Storage buffer 1 */
  268.   APTR   prvStoreB;           /* Storage buffer 2 */
  269.   APTR   prvStoreC;           /* Storage buffer 3 */
  270.   APTR   prvDrawRoutine;      /* Routine for drawing/clearing/storing */
  271.   APTR   prvClearRoutine;     /* Routine for clearing */
  272.   APTR   prvRestoreRoutine;   /* Routine for restoring/clearing */
  273.   APTR   prvHeightRoutine;    /* Replaces BS_DrawRoutine for large heights */
  274.   LONG   prvScreenSize;       /* Size of destination plane */
  275.   WORD   prvModulo;           /* Bob Modulo (PicWidth-BobWidth) */
  276.   WORD   prvMaskModulo;       /* Mask Modulo (BobWidth-BobWidth for GENMASK) */
  277.   APTR   prvMaskMemory;       /* Master mask pointer (for the freemem) */
  278.   WORD   prvMaxHeight;        /* Maximum possible height, limited by blitter */
  279.   WORD   prvScrLine;          /* Size of a line (for interleaved) */
  280.   WORD   prvBOBLine;          /* Size of a Bob line (Width*Planes) */
  281.   WORD   prvMaskLine;         /* Size of a Mask Line (Width*Planes) */
  282.   WORD   prvTrueWidth;        /* The true pixel width (++shift) */
  283.   WORD   prvTrueBWidth;       /* The true byte width (++shift) */
  284.   WORD   prvTrueWWidth;       /* The true word width (++shift) */
  285.   WORD   prvClipBLX;          /* ClipLX, byte */
  286.   WORD   prvClipBRX;          /* ClipRX, byte */
  287.   LONG   prvModulo1;          /* Modulus (C/B) */ 
  288.   LONG   prvModulo2;          /* Modulus (A/D) */ 
  289.   LONG   prvNSModulo1;        /* Modulus (C/B) */ 
  290.   LONG   prvNSModulo2;        /* Modulus (A/D) */ 
  291.   WORD   prvWordWidth;        /* The word width */
  292.   BYTE   prvAFlags;           /* Allocation flags */
  293.   BYTE   prvPad;
  294. };
  295.  
  296. #define MBA_GfxData      (12|TAPTR)
  297. #define MBA_MaskData     (16|TAPTR)
  298. #define MBA_FrameList    (22|TAPTR)
  299. #define MBA_AmtEntries   (20|TWORD)
  300. #define MBA_SrcWidth     (26|TWORD)
  301. #define MBA_Width        (28|TWORD)
  302. #define MBA_ByteWidth    (30|TWORD)
  303. #define MBA_EntryList    (32|TWORD)
  304. #define MBA_Height       (36|TWORD)
  305. #define MBA_ClipLX       (38|TWORD)
  306. #define MBA_ClipTY       (40|TWORD)
  307. #define MBA_ClipRX       (42|TWORD)
  308. #define MBA_ClipBY       (44|TWORD)
  309. #define MBA_FPlane       (46|TWORD)
  310. #define MBA_Planes       (48|TWORD)
  311. #define MBA_PropHeight   (50|TWORD)
  312. #define MBA_PropWidth    (52|TWORD)
  313. #define MBA_Buffers      (54|TWORD)
  314. #define MBA_PlaneSize    (56|TLONG)
  315. #define MBA_Attrib       (60|TLONG)
  316. /*      MBA_SrcBitmap    (64|TAPTR)*/
  317. #define MBA_EntrySize    (68|TWORD)
  318. #define MBA_SrcMaskWidth (70|TWORD)
  319. #define MBA_Source       (72|TAPTR)
  320. #define MBA_DirectList   (76|TAPTR)
  321. #define MBA_Screen       (80|TAPTR)
  322. #define MBA_DestBitmap   (84|TAPTR)
  323. #define MBA_MaskCoords   (88|TAPTR)
  324. #define MBA_DirectMasks  (92|TAPTR)
  325. #define MBA_AmtFrames    (96|TWORD)
  326.  
  327. struct MBEntry {        /* MBob Entry Structure */
  328.   WORD XCoord;
  329.   WORD YCoord;
  330.   WORD Frame;
  331. };
  332.  
  333. #define MBE_SIZEOF (sizeof(struct BobEntry))
  334.  
  335. /* Bob Attributes (Bob.Attrib) */
  336.  
  337. #define BBF_CLIP      0x00000001 /* Allow border clipping */
  338. #define BBF_MASK      0x00000002 /* Allow masking */
  339. #define BBF_STILL     0x00000004 /* This bob is not moving */
  340. #define BBF_CLEAR     0x00000008 /* Allow automatic clearing */
  341. #define BBF_RESTORE   0x00000010 /* Allow automatic background restore */
  342. /*#define           0x00000020   */
  343. #define BBF_FILLMASK  0x00000040 /* Fill any holes in the mask on generation */
  344. #define BBF_GENONLY   0x00000080 /* Create masks but do not use them yet */
  345. #define BBF_GENMASKS  0x00000082 /* Create and use masks for drawing this bob */
  346. #define BBF_CLRMASK   0x00000100 /* Use masks when clearing */
  347. #define BBF_CLRNOMASK 0x00000000 /* Do not use masks when clearing (default) */
  348.  
  349. #define BBF_GENMASK BBF_GENMASKS /* Synonym */
  350.  
  351. #define SKIPIMAGE 32000
  352.  
  353. /****************************************************************************
  354. ** Pixel list structures.
  355. */
  356.  
  357. struct PixelEntry {
  358.   WORD XCoord;
  359.   WORD YCoord;
  360.   LONG Colour;
  361. };
  362.  
  363. struct PixelList {
  364.   WORD   Entries;
  365.   WORD   EntrySize;
  366.   struct PixelEntry *EntryList;
  367. };
  368.  
  369. #define SKIPPIXEL -32000
  370. #define PIXELLIST(a)
  371.  
  372. /****************************************************************************
  373. ** Map object.
  374. */
  375.  
  376. #define MAPVERSION 1
  377. #define TAGS_MAP   ((ID_SPCTAGS<<16)|ID_MAP)
  378.  
  379. struct Map {
  380.   struct Head Head;        /* Standard structure header */
  381.   WORD   Buffer;           /* Destination buffer */
  382.   WORD   Number;           /* Map number to access for data */
  383.   APTR   MapList;          /* Pointer to the map datalist */
  384.   WORD   Width;            /* Total width of map */
  385.   WORD   Height;           /* Total height of map */
  386.   WORD   XStart;           /* Get block data starting from X [byte] */
  387.   WORD   YStart;           /* Get block data starting from Y */
  388.   WORD   EntrySize;        /* Byte/Word/Long */
  389.   LONG   EntryMask;        /* For special cases */
  390.   WORD   TileWidth;        /* The width/8 of each tile (bytes) */
  391.   WORD   TileHeight;       /* The height of each tile */
  392.   WORD   Options;          /* Applicable Map options, eg LOCKED */
  393.   struct Picture *Picture; /* Points to the map's graphics picture */
  394.   char   *File;            /* Where to get the map data */
  395. };
  396.  
  397. #define LOCKED      0x0001 /* Blocks are blitted on 16 pixel boundaries  */
  398. #define ESIZE_BYTE  1      /* Entry size is in bytes */
  399. #define ESIZE_WORD  2      /* Entry size is in words */
  400. #define ESIZE_LONG  3      /* Entry size is in longs */
  401.  
  402. #endif /* GRAPHICS_BLITTER_H */
  403.